﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Locations
{
    /// <summary>
    /// Interaction logic for dialogContactPointType.xaml
    /// </summary>
    public partial class dialogContactPointType : Window
    {
        private SalesManagerEntities _context = null;
        CollectionViewSource _contactPointTypeViewSource;

        public dialogContactPointType(SalesManagerEntities context)
        {
            InitializeComponent();

            _context = context;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _contactPointTypeViewSource = (CollectionViewSource)FindResource("ContactPointType");
            _contactPointTypeViewSource.Source = from c in _context.codeContactPointType
                                                select c;
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            Close();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }

        public codeContactPointType SelectedContactPointType
        {
            get
            {
                return (codeContactPointType)_contactPointTypeViewSource.View.CurrentItem;
            }
        }

        private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            btnOK_Click(null, null);
        }
    }
}
